<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>BadgerDB: /home/ubuntu/study/dbmslab/lab2/BufMgr/src/file.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">BadgerDB
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_43e0a1f539e00dcfa1a6bc4d4fee4fc2.html">home</a></li><li class="navelem"><a class="el" href="dir_f895279abf3c9abddbac24b9a320b4c6.html">ubuntu</a></li><li class="navelem"><a class="el" href="dir_9223221a80e1dde112a2f0d1c0d6bc8d.html">study</a></li><li class="navelem"><a class="el" href="dir_565d95caf30f979632cef261ad9a6ed4.html">dbmslab</a></li><li class="navelem"><a class="el" href="dir_04bc7b587b42191e49c8f970037360ad.html">lab2</a></li><li class="navelem"><a class="el" href="dir_ccc57109e70d5b9b219c75d9ecb5bc70.html">BufMgr</a></li><li class="navelem"><a class="el" href="dir_57419356550b183f8cb4d89f81ab51b6.html">src</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">file.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160; </div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160; </div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &lt;fstream&gt;</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;map&gt;</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;memory&gt;</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160; </div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &quot;page.h&quot;</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160; </div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacebadgerdb.html">badgerdb</a> {</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160; </div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="keyword">class </span>FileIterator;</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160; </div>
<div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="structbadgerdb_1_1_file_header.html">   24</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structbadgerdb_1_1_file_header.html">FileHeader</a> {</div>
<div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="structbadgerdb_1_1_file_header.html#aa1cfc5220c6795868c8301cec298c8a6">   28</a></span>&#160;  <a class="code" href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a">PageId</a> <a class="code" href="structbadgerdb_1_1_file_header.html#aa1cfc5220c6795868c8301cec298c8a6">num_pages</a>;</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160; </div>
<div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="structbadgerdb_1_1_file_header.html#ad006b5b9d02b8c20e7ad5226680779c6">   33</a></span>&#160;  <a class="code" href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a">PageId</a> <a class="code" href="structbadgerdb_1_1_file_header.html#ad006b5b9d02b8c20e7ad5226680779c6">first_used_page</a>;</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160; </div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="structbadgerdb_1_1_file_header.html#a07ac20f98d6aced3eb5358e0d4830abc">   38</a></span>&#160;  <a class="code" href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a">PageId</a> <a class="code" href="structbadgerdb_1_1_file_header.html#a07ac20f98d6aced3eb5358e0d4830abc">num_free_pages</a>;</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160; </div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="structbadgerdb_1_1_file_header.html#aa86917d8554a42318c795471f32ad006">   43</a></span>&#160;  <a class="code" href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a">PageId</a> <a class="code" href="structbadgerdb_1_1_file_header.html#aa86917d8554a42318c795471f32ad006">first_free_page</a>;</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160; </div>
<div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="structbadgerdb_1_1_file_header.html#ae1f662fea1e092100041c96be576f9d6">   51</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="structbadgerdb_1_1_file_header.html#ae1f662fea1e092100041c96be576f9d6">operator==</a>(<span class="keyword">const</span> <a class="code" href="structbadgerdb_1_1_file_header.html">FileHeader</a>&amp; rhs)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="structbadgerdb_1_1_file_header.html#aa1cfc5220c6795868c8301cec298c8a6">num_pages</a> == rhs.<a class="code" href="structbadgerdb_1_1_file_header.html#aa1cfc5220c6795868c8301cec298c8a6">num_pages</a> &amp;&amp;</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;        <a class="code" href="structbadgerdb_1_1_file_header.html#a07ac20f98d6aced3eb5358e0d4830abc">num_free_pages</a> == rhs.<a class="code" href="structbadgerdb_1_1_file_header.html#a07ac20f98d6aced3eb5358e0d4830abc">num_free_pages</a> &amp;&amp;</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;        <a class="code" href="structbadgerdb_1_1_file_header.html#ad006b5b9d02b8c20e7ad5226680779c6">first_used_page</a> == rhs.<a class="code" href="structbadgerdb_1_1_file_header.html#ad006b5b9d02b8c20e7ad5226680779c6">first_used_page</a> &amp;&amp;</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;        <a class="code" href="structbadgerdb_1_1_file_header.html#aa86917d8554a42318c795471f32ad006">first_free_page</a> == rhs.<a class="code" href="structbadgerdb_1_1_file_header.html#aa86917d8554a42318c795471f32ad006">first_free_page</a>;</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;  }</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;};</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160; </div>
<div class="line"><a name="l00073"></a><span class="lineno"><a class="line" href="classbadgerdb_1_1_file.html">   73</a></span>&#160;<span class="keyword">class </span><a class="code" href="classbadgerdb_1_1_file.html">File</a> {</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;  <span class="keyword">static</span> <a class="code" href="classbadgerdb_1_1_file.html">File</a> <a class="code" href="classbadgerdb_1_1_file.html#a1fb708b45103a606f189850d6bf83a0c">create</a>(<span class="keyword">const</span> std::string&amp; <a class="code" href="classbadgerdb_1_1_file.html#af16040a60f18c99305348077ac9e8aa8">filename</a>);</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160; </div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;  <span class="keyword">static</span> <a class="code" href="classbadgerdb_1_1_file.html">File</a> <a class="code" href="classbadgerdb_1_1_file.html#a8462afdbd250c0a483ddfbde144c8732">open</a>(<span class="keyword">const</span> std::string&amp; <a class="code" href="classbadgerdb_1_1_file.html#af16040a60f18c99305348077ac9e8aa8">filename</a>);</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160; </div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;  <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classbadgerdb_1_1_file.html#a1cc69467366badbd68021ac76a91190e">remove</a>(<span class="keyword">const</span> std::string&amp; <a class="code" href="classbadgerdb_1_1_file.html#af16040a60f18c99305348077ac9e8aa8">filename</a>);</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160; </div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;  <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classbadgerdb_1_1_file.html#a64836156a9bb5f81d2c2c4e6f3ada24d">isOpen</a>(<span class="keyword">const</span> std::string&amp; <a class="code" href="classbadgerdb_1_1_file.html#af16040a60f18c99305348077ac9e8aa8">filename</a>);</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160; </div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160; </div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;  <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classbadgerdb_1_1_file.html#a864d59b12302c26b14967bd1d3e520bd">exists</a>(<span class="keyword">const</span> std::string&amp; <a class="code" href="classbadgerdb_1_1_file.html#af16040a60f18c99305348077ac9e8aa8">filename</a>);</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160; </div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;  <a class="code" href="classbadgerdb_1_1_file.html#a600baaf77d18f39e51ae7473eca633c4">File</a>(<span class="keyword">const</span> <a class="code" href="classbadgerdb_1_1_file.html">File</a>&amp; other);</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160; </div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;  <a class="code" href="classbadgerdb_1_1_file.html">File</a>&amp; <a class="code" href="classbadgerdb_1_1_file.html#ac403c631aec085e9f12992f260a57155">operator=</a>(<span class="keyword">const</span> <a class="code" href="classbadgerdb_1_1_file.html">File</a>&amp; rhs);</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160; </div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;  <a class="code" href="classbadgerdb_1_1_file.html#a97fd6e3ae8dd11be883289b69d560287">~File</a>();</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160; </div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;  <a class="code" href="classbadgerdb_1_1_page.html">Page</a> <a class="code" href="classbadgerdb_1_1_file.html#a7d0e047bcc8dc4cee36aac5b2060bbe3">allocatePage</a>();</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160; </div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;  <a class="code" href="classbadgerdb_1_1_page.html">Page</a> <a class="code" href="classbadgerdb_1_1_file.html#a343b7fb1a238992f02454e9e81837acd">readPage</a>(<span class="keyword">const</span> <a class="code" href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a">PageId</a> page_number) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160; </div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classbadgerdb_1_1_file.html#a9a1b3cc43c4631bde58c1c4f670e1036">writePage</a>(<span class="keyword">const</span> <a class="code" href="classbadgerdb_1_1_page.html">Page</a>&amp; new_page);</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160; </div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classbadgerdb_1_1_file.html#a829a68ccfbeb0c9f66f3a2db7e0b99fe">deletePage</a>(<span class="keyword">const</span> <a class="code" href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a">PageId</a> page_number);</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160; </div>
<div class="line"><a name="l00179"></a><span class="lineno"><a class="line" href="classbadgerdb_1_1_file.html#af16040a60f18c99305348077ac9e8aa8">  179</a></span>&#160;  <span class="keyword">const</span> std::string&amp; <a class="code" href="classbadgerdb_1_1_file.html#af16040a60f18c99305348077ac9e8aa8">filename</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> filename_; }</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160; </div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;  <a class="code" href="classbadgerdb_1_1_file_iterator.html">FileIterator</a> <a class="code" href="classbadgerdb_1_1_file.html#a32e94f392eb3740dd9eb9101b9e09d47">begin</a>();</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160; </div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;  <a class="code" href="classbadgerdb_1_1_file_iterator.html">FileIterator</a> <a class="code" href="classbadgerdb_1_1_file.html#a01e224676a67634f21d53fc4189b8f11">end</a>();</div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160; </div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;  <span class="keyword">static</span> std::streampos pagePosition(<span class="keyword">const</span> <a class="code" href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a">PageId</a> page_number) {</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">sizeof</span>(<a class="code" href="structbadgerdb_1_1_file_header.html">FileHeader</a>) + ((page_number - 1) * <a class="code" href="classbadgerdb_1_1_page.html#ae92d52803502854f97309bae2c14ea55">Page::SIZE</a>);</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;  }</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160; </div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;  <a class="code" href="classbadgerdb_1_1_file.html#a600baaf77d18f39e51ae7473eca633c4">File</a>(<span class="keyword">const</span> std::string&amp; name, <span class="keyword">const</span> <span class="keywordtype">bool</span> create_new);</div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160; </div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;  <span class="keywordtype">void</span> openIfNeeded(<span class="keyword">const</span> <span class="keywordtype">bool</span> create_new);</div>
<div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160; </div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;  <span class="keywordtype">void</span> close();</div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160; </div>
<div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;  Page <a class="code" href="classbadgerdb_1_1_file.html#a343b7fb1a238992f02454e9e81837acd">readPage</a>(<span class="keyword">const</span> <a class="code" href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a">PageId</a> page_number, <span class="keyword">const</span> <span class="keywordtype">bool</span> allow_free) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160; </div>
<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classbadgerdb_1_1_file.html#a9a1b3cc43c4631bde58c1c4f670e1036">writePage</a>(<span class="keyword">const</span> <a class="code" href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a">PageId</a> page_number, <span class="keyword">const</span> Page&amp; new_page);</div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160; </div>
<div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classbadgerdb_1_1_file.html#a9a1b3cc43c4631bde58c1c4f670e1036">writePage</a>(<span class="keyword">const</span> <a class="code" href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a">PageId</a> page_number, <span class="keyword">const</span> PageHeader&amp; header,</div>
<div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160;                 <span class="keyword">const</span> Page&amp; new_page);</div>
<div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160; </div>
<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;  FileHeader readHeader() <span class="keyword">const</span>;</div>
<div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160; </div>
<div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;  <span class="keywordtype">void</span> writeHeader(<span class="keyword">const</span> FileHeader&amp; header);</div>
<div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160; </div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;  PageHeader readPageHeader(<span class="keyword">const</span> <a class="code" href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a">PageId</a> page_number) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160; </div>
<div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;  <span class="keyword">typedef</span> std::map&lt;std::string,</div>
<div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;                   std::shared_ptr&lt;std::fstream&gt; &gt; StreamMap;</div>
<div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160;  <span class="keyword">typedef</span> std::map&lt;std::string, int&gt; CountMap;</div>
<div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160; </div>
<div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;  <span class="keyword">static</span> StreamMap open_streams_;</div>
<div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160; </div>
<div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;  <span class="keyword">static</span> CountMap open_counts_;</div>
<div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160; </div>
<div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;  std::string filename_;</div>
<div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160; </div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;  std::shared_ptr&lt;std::fstream&gt; stream_;</div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160; </div>
<div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;  <span class="keyword">friend</span> <span class="keyword">class </span>FileIterator;</div>
<div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;  <span class="keyword">friend</span> <span class="keyword">class </span>FileTest;</div>
<div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160;};</div>
<div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160; </div>
<div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160;}</div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="anamespacebadgerdb_html"><div class="ttname"><a href="namespacebadgerdb.html">badgerdb</a></div><div class="ttdef"><b>Definition:</b> <a href="buffer_8cpp_source.html#l00017">buffer.cpp:17</a></div></div>
<div class="ttc" id="astructbadgerdb_1_1_file_header_html_aa1cfc5220c6795868c8301cec298c8a6"><div class="ttname"><a href="structbadgerdb_1_1_file_header.html#aa1cfc5220c6795868c8301cec298c8a6">badgerdb::FileHeader::num_pages</a></div><div class="ttdeci">PageId num_pages</div><div class="ttdef"><b>Definition:</b> <a href="file_8h_source.html#l00028">file.h:28</a></div></div>
<div class="ttc" id="aclassbadgerdb_1_1_file_html_a8462afdbd250c0a483ddfbde144c8732"><div class="ttname"><a href="classbadgerdb_1_1_file.html#a8462afdbd250c0a483ddfbde144c8732">badgerdb::File::open</a></div><div class="ttdeci">static File open(const std::string &amp;filename)</div><div class="ttdef"><b>Definition:</b> <a href="file_8cpp_source.html#l00033">file.cpp:33</a></div></div>
<div class="ttc" id="aclassbadgerdb_1_1_file_html_a9a1b3cc43c4631bde58c1c4f670e1036"><div class="ttname"><a href="classbadgerdb_1_1_file.html#a9a1b3cc43c4631bde58c1c4f670e1036">badgerdb::File::writePage</a></div><div class="ttdeci">void writePage(const Page &amp;new_page)</div><div class="ttdef"><b>Definition:</b> <a href="file_8cpp_source.html#l00169">file.cpp:169</a></div></div>
<div class="ttc" id="aclassbadgerdb_1_1_file_html_a1fb708b45103a606f189850d6bf83a0c"><div class="ttname"><a href="classbadgerdb_1_1_file.html#a1fb708b45103a606f189850d6bf83a0c">badgerdb::File::create</a></div><div class="ttdeci">static File create(const std::string &amp;filename)</div><div class="ttdef"><b>Definition:</b> <a href="file_8cpp_source.html#l00029">file.cpp:29</a></div></div>
<div class="ttc" id="aclassbadgerdb_1_1_page_html_ae92d52803502854f97309bae2c14ea55"><div class="ttname"><a href="classbadgerdb_1_1_page.html#ae92d52803502854f97309bae2c14ea55">badgerdb::Page::SIZE</a></div><div class="ttdeci">static const std::size_t SIZE</div><div class="ttdef"><b>Definition:</b> <a href="page_8h_source.html#l00113">page.h:113</a></div></div>
<div class="ttc" id="aclassbadgerdb_1_1_file_html_a829a68ccfbeb0c9f66f3a2db7e0b99fe"><div class="ttname"><a href="classbadgerdb_1_1_file.html#a829a68ccfbeb0c9f66f3a2db7e0b99fe">badgerdb::File::deletePage</a></div><div class="ttdeci">void deletePage(const PageId page_number)</div><div class="ttdef"><b>Definition:</b> <a href="file_8cpp_source.html#l00184">file.cpp:184</a></div></div>
<div class="ttc" id="aclassbadgerdb_1_1_file_html_a1cc69467366badbd68021ac76a91190e"><div class="ttname"><a href="classbadgerdb_1_1_file.html#a1cc69467366badbd68021ac76a91190e">badgerdb::File::remove</a></div><div class="ttdeci">static void remove(const std::string &amp;filename)</div><div class="ttdef"><b>Definition:</b> <a href="file_8cpp_source.html#l00037">file.cpp:37</a></div></div>
<div class="ttc" id="astructbadgerdb_1_1_file_header_html"><div class="ttname"><a href="structbadgerdb_1_1_file_header.html">badgerdb::FileHeader</a></div><div class="ttdoc">Header metadata for files on disk which contain pages.</div><div class="ttdef"><b>Definition:</b> <a href="file_8h_source.html#l00024">file.h:24</a></div></div>
<div class="ttc" id="astructbadgerdb_1_1_file_header_html_a07ac20f98d6aced3eb5358e0d4830abc"><div class="ttname"><a href="structbadgerdb_1_1_file_header.html#a07ac20f98d6aced3eb5358e0d4830abc">badgerdb::FileHeader::num_free_pages</a></div><div class="ttdeci">PageId num_free_pages</div><div class="ttdef"><b>Definition:</b> <a href="file_8h_source.html#l00038">file.h:38</a></div></div>
<div class="ttc" id="aclassbadgerdb_1_1_file_html_a7d0e047bcc8dc4cee36aac5b2060bbe3"><div class="ttname"><a href="classbadgerdb_1_1_file.html#a7d0e047bcc8dc4cee36aac5b2060bbe3">badgerdb::File::allocatePage</a></div><div class="ttdeci">Page allocatePage()</div><div class="ttdef"><b>Definition:</b> <a href="file_8cpp_source.html#l00084">file.cpp:84</a></div></div>
<div class="ttc" id="aclassbadgerdb_1_1_file_html"><div class="ttname"><a href="classbadgerdb_1_1_file.html">badgerdb::File</a></div><div class="ttdoc">Class which represents a file in the filesystem containing database pages.</div><div class="ttdef"><b>Definition:</b> <a href="file_8h_source.html#l00073">file.h:73</a></div></div>
<div class="ttc" id="astructbadgerdb_1_1_file_header_html_ad006b5b9d02b8c20e7ad5226680779c6"><div class="ttname"><a href="structbadgerdb_1_1_file_header.html#ad006b5b9d02b8c20e7ad5226680779c6">badgerdb::FileHeader::first_used_page</a></div><div class="ttdeci">PageId first_used_page</div><div class="ttdef"><b>Definition:</b> <a href="file_8h_source.html#l00033">file.h:33</a></div></div>
<div class="ttc" id="anamespacebadgerdb_html_a1f49e404293bf4240756b89b53b1587a"><div class="ttname"><a href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a">badgerdb::PageId</a></div><div class="ttdeci">std::uint32_t PageId</div><div class="ttdoc">Identifier for a page in a file.</div><div class="ttdef"><b>Definition:</b> <a href="types_8h_source.html#l00015">types.h:15</a></div></div>
<div class="ttc" id="aclassbadgerdb_1_1_file_html_a97fd6e3ae8dd11be883289b69d560287"><div class="ttname"><a href="classbadgerdb_1_1_file.html#a97fd6e3ae8dd11be883289b69d560287">badgerdb::File::~File</a></div><div class="ttdeci">~File()</div><div class="ttdef"><b>Definition:</b> <a href="file_8cpp_source.html#l00080">file.cpp:80</a></div></div>
<div class="ttc" id="aclassbadgerdb_1_1_file_html_a600baaf77d18f39e51ae7473eca633c4"><div class="ttname"><a href="classbadgerdb_1_1_file.html#a600baaf77d18f39e51ae7473eca633c4">badgerdb::File::File</a></div><div class="ttdeci">File(const File &amp;other)</div><div class="ttdef"><b>Definition:</b> <a href="file_8cpp_source.html#l00065">file.cpp:65</a></div></div>
<div class="ttc" id="astructbadgerdb_1_1_file_header_html_ae1f662fea1e092100041c96be576f9d6"><div class="ttname"><a href="structbadgerdb_1_1_file_header.html#ae1f662fea1e092100041c96be576f9d6">badgerdb::FileHeader::operator==</a></div><div class="ttdeci">bool operator==(const FileHeader &amp;rhs) const</div><div class="ttdef"><b>Definition:</b> <a href="file_8h_source.html#l00051">file.h:51</a></div></div>
<div class="ttc" id="aclassbadgerdb_1_1_page_html"><div class="ttname"><a href="classbadgerdb_1_1_page.html">badgerdb::Page</a></div><div class="ttdoc">Class which represents a fixed-size database page containing records.</div><div class="ttdef"><b>Definition:</b> <a href="page_8h_source.html#l00107">page.h:107</a></div></div>
<div class="ttc" id="aclassbadgerdb_1_1_file_html_af16040a60f18c99305348077ac9e8aa8"><div class="ttname"><a href="classbadgerdb_1_1_file.html#af16040a60f18c99305348077ac9e8aa8">badgerdb::File::filename</a></div><div class="ttdeci">const std::string &amp; filename() const</div><div class="ttdef"><b>Definition:</b> <a href="file_8h_source.html#l00179">file.h:179</a></div></div>
<div class="ttc" id="aclassbadgerdb_1_1_file_html_a864d59b12302c26b14967bd1d3e520bd"><div class="ttname"><a href="classbadgerdb_1_1_file.html#a864d59b12302c26b14967bd1d3e520bd">badgerdb::File::exists</a></div><div class="ttdeci">static bool exists(const std::string &amp;filename)</div><div class="ttdef"><b>Definition:</b> <a href="file_8cpp_source.html#l00054">file.cpp:54</a></div></div>
<div class="ttc" id="aclassbadgerdb_1_1_file_html_a343b7fb1a238992f02454e9e81837acd"><div class="ttname"><a href="classbadgerdb_1_1_file.html#a343b7fb1a238992f02454e9e81837acd">badgerdb::File::readPage</a></div><div class="ttdeci">Page readPage(const PageId page_number) const</div><div class="ttdef"><b>Definition:</b> <a href="file_8cpp_source.html#l00149">file.cpp:149</a></div></div>
<div class="ttc" id="aclassbadgerdb_1_1_file_html_a64836156a9bb5f81d2c2c4e6f3ada24d"><div class="ttname"><a href="classbadgerdb_1_1_file.html#a64836156a9bb5f81d2c2c4e6f3ada24d">badgerdb::File::isOpen</a></div><div class="ttdeci">static bool isOpen(const std::string &amp;filename)</div><div class="ttdef"><b>Definition:</b> <a href="file_8cpp_source.html#l00047">file.cpp:47</a></div></div>
<div class="ttc" id="aclassbadgerdb_1_1_file_html_a32e94f392eb3740dd9eb9101b9e09d47"><div class="ttname"><a href="classbadgerdb_1_1_file.html#a32e94f392eb3740dd9eb9101b9e09d47">badgerdb::File::begin</a></div><div class="ttdeci">FileIterator begin()</div><div class="ttdef"><b>Definition:</b> <a href="file_8cpp_source.html#l00214">file.cpp:214</a></div></div>
<div class="ttc" id="aclassbadgerdb_1_1_file_html_a01e224676a67634f21d53fc4189b8f11"><div class="ttname"><a href="classbadgerdb_1_1_file.html#a01e224676a67634f21d53fc4189b8f11">badgerdb::File::end</a></div><div class="ttdeci">FileIterator end()</div><div class="ttdef"><b>Definition:</b> <a href="file_8cpp_source.html#l00219">file.cpp:219</a></div></div>
<div class="ttc" id="astructbadgerdb_1_1_file_header_html_aa86917d8554a42318c795471f32ad006"><div class="ttname"><a href="structbadgerdb_1_1_file_header.html#aa86917d8554a42318c795471f32ad006">badgerdb::FileHeader::first_free_page</a></div><div class="ttdeci">PageId first_free_page</div><div class="ttdef"><b>Definition:</b> <a href="file_8h_source.html#l00043">file.h:43</a></div></div>
<div class="ttc" id="aclassbadgerdb_1_1_file_html_ac403c631aec085e9f12992f260a57155"><div class="ttname"><a href="classbadgerdb_1_1_file.html#ac403c631aec085e9f12992f260a57155">badgerdb::File::operator=</a></div><div class="ttdeci">File &amp; operator=(const File &amp;rhs)</div><div class="ttdef"><b>Definition:</b> <a href="file_8cpp_source.html#l00071">file.cpp:71</a></div></div>
<div class="ttc" id="aclassbadgerdb_1_1_file_iterator_html"><div class="ttname"><a href="classbadgerdb_1_1_file_iterator.html">badgerdb::FileIterator</a></div><div class="ttdoc">Iterator for iterating over the pages in a file.</div><div class="ttdef"><b>Definition:</b> <a href="file__iterator_8h_source.html#l00023">file_iterator.h:23</a></div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>
